{extends 'form.html'}
{block name="nav_user"}			
	<ul class="current">
		<li><a href="ctlr_user-act_all"><b>Users</b><!--[if IE 7]><!--></a><!--<![endif]-->
			<!--[if lte IE 6]><table><tr><td><![endif]-->
			<div class="select_sub show">
				<ul class="sub">
					<li><a href="ctlr_user-act_all">View all users</a></li>
					
					<li {if !isset($user->id) || $user->id eq ""}class="sub_show"{/if}>
						<a href="ctlr_user-act_create">Add user</a>
					</li>
					<li {if isset($user->id) && $user->id ne ""}class="sub_show"{/if}>
						<a href="#nogo">edit user</a>
					</li>
				</ul>
			</div>
			<!--[if lte IE 6]></td></tr></table></a><![endif]-->
		</li>
	</ul>
	<div class="nav-divider">&nbsp;</div>
{/block}
{block name="op-title"}
	{if isset($user->id) && $user->id ne ""}
		<h1>Edit user - : {$user->username}</h1>
	{else}
		<h1>Add user</h1>
	{/if}
{/block}
{block name="msgs"}
		<div id="message-blue">
			<table border="0" width="100%" cellpadding="0" cellspacing="0">
				<tr>
					<td class="blue-left">Welcome back. <a href="ctlr_user-act_all">View users.</a> </td>
					<td class="blue-right"><a class="close-blue"><img src="{$assets}images/table/icon_close_blue.gif"   alt="" /></a></td>
				</tr>
			</table>
		</div>
		{if isset($validate_errors)}
		<div id="message-red">
			<table border="0" width="100%" cellpadding="0" cellspacing="0">
			<tr>
				<td class="red-left">Error. <a href="">Please try again.</a></td>
				<td class="red-right"><a class="close-red"><img src="{$assets}images/table/icon_close_red.gif"   alt="" /></a></td>
			</tr>
			</table>
		</div>
		{/if}
		{if isset($info)}
		<div id="message-green">
			<table border="0" width="100%" cellpadding="0" cellspacing="0">
				<tr>
					<td class="green-left">{$info}. <a href="ctlr_user-act_create">Add new one.</a></td>
					<td class="green-right"><a class="close-green"><img src="{$assets}images/table/icon_close_green.gif"   alt="" /></a></td>
				</tr>
			</table>
		</div>
		{/if}		
{/block}
{block name="tabs"}
		{if isset($user->id) && $user->id ne ""}
			<div id="tab-holder">
				<div class="step-dark"><a href="ctlr_user-act_edit?id={$user->id}">General</a></div>
				<div class="step-light"><a href="ctlr_user-act_preview?id={$user->id}">Preview</a></div>
				<div class="clear"></div>
			</div>
		{else}
			<div id="tab-holder">
				<div class="step-dark">General</div>
				<div class="step-light">Preview</div>
				<div class="clear"></div>
			</div>
		{/if}
{/block}
{block name="main"}
	{if isset($user->id) && $user->id ne ""}
	<form name="user_edit" method='POST' action="ctlr_user-act_update" accept-charset='UTF-8'>
		<input type="hidden" name="id" value="{$user->id}">
	{else}
	<form name="user_new" method='POST' action="ctlr_user-act_save" accept-charset='UTF-8'>
	{/if}
		<table border="0" cellpadding="0" cellspacing="0"  id="id-form">
			<tr>
				<th valign="top">User Type:</th>
				<td>
					<select  name="type" class="styledselect_form_1">
						<option value="admin" {if $user->type eq 'admin'}selected {/if}>Admin</option>
						<option value="member" {if $user->type eq 'member'}selected {/if} >Member</option>
					</select>
				</td>	
				<td>
					<div class="bubble-left"></div>
					<div class="bubble-inner">Please select user type.</div>
					<div class="bubble-right"></div>
				</td>
			</tr>
			<tr>
				<th valign="top">First Name:</th>
				<td>
					<input type="text" name="firstname" 
					{if isset($validate_errors['firstname'])}
						class="inp-form-error" 
					{else} 
						class="inp-form" 
					{/if} 
					value="{$user->firstname}"/>
				</td>	
				<td>
					{if isset($validate_errors['firstname'])}
						<div class="error-left"></div>
						<div class="error-inner">This field is required.</div>
					{else}
						<div class="bubble-left"></div>
						<div class="bubble-inner">Please provide first name.</div>
						<div class="bubble-right"></div>
					{/if}
				</td>
			</tr>
			<tr>
				<th valign="top">Last Name:</th>
				<td>
					<input type="text" name="lastname" 
					{if isset($validate_errors['lastname'])}
						class="inp-form-error" 
					{else} 
						class="inp-form" 
					{/if} 
					value="{$user->lastname}"/>
				</td>	
				<td>
					{if isset($validate_errors['lastname'])}
						<div class="error-left"></div>
						<div class="error-inner">This field is required.</div>
					{else}
						<div class="bubble-left"></div>
						<div class="bubble-inner">Please provide last name.</div>
						<div class="bubble-right"></div>
					{/if}
				</td>
			</tr>
			<tr>
				<th valign="top">Email ID:</th>
				<td>
					<input type="text" name="email" 
					{if isset($validate_errors['email'])}
						class="inp-form-error" 
					{else} 
						class="inp-form" 
					{/if} 
					value="{$user->email}"/>
				</td>	
				<td>
					{if isset($validate_errors['email'])}
						<div class="error-left"></div>
						<div class="error-inner">This field is required.</div>
					{else}
						<div class="bubble-left"></div>
						<div class="bubble-inner">Please provide email.</div>
						<div class="bubble-right"></div>
					{/if}
				</td>
			</tr>		
			<tr>
				<th valign="top">Username:</th>
				<td>
					<input type="text" name="username" 
					{if isset($validate_errors['username'])}
						class="inp-form-error" 
					{else} 
						class="inp-form" 
					{/if} 
					value="{$user->username}"/>
				</td>	
				<td>
					{if isset($validate_errors['username'])}
						<div class="error-left"></div>
						<div class="error-inner">This field is required.</div>
					{else}
						<div class="bubble-left"></div>
						<div class="bubble-inner">This field is required.</div>
						<div class="bubble-right"></div>
					{/if}
				</td>
			</tr>
			<tr>
				<th valign="top">Password:</th>
				<td>
					<input type="text" name="pass" 
					{if isset($validate_errors['pass'])}
						class="inp-form-error" 
					{else} 
						class="inp-form" 
					{/if} 
					value=""/>
				</td>	
				<td>
					{if isset($validate_errors['pass'])}
						<div class="error-left"></div>
						<div class="error-inner">This field is required.</div>
					{else}
						<div class="bubble-left"></div>
						<div class="bubble-inner">This field is required.</div>
						<div class="bubble-right"></div>
					{/if}
				</td>
			</tr>
			<tr>	
				<th>&nbsp;</th>
				<td valign="top">
					<input type="submit" name="Submit" value="Submit" class="form-submit" />
					<input type="reset" value="" class="form-reset"  />
				</td>
				<td></td>
			</tr>
		</table>
	</form>
{/block}
{block name="act"}
		<div id="related-activities">
			<div id="related-act-top">
				<img src="{$assets}images/forms/header_related_act.gif" width="271" height="43" alt="" />
			</div>
			<div id="related-act-bottom">
				<div id="related-act-inner">			
					<div class="left"><a href="ctlr_user-act_create"><img src="{$assets}images/forms/icon_plus.gif" width="21" height="21" alt="" /></a></div>
						<div class="right">
							<h5>Add another user</h5>
							<ul class="greyarrow">
								<li><a href="ctlr_user-act_create">Click here</a></li> 
							</ul>
						</div>
						
						<div class="clear"></div>
					{if isset($user->id) && $user->id ne ""}
						<div class="lines-dotted-short"></div>
						
						<div class="left"><a href="ctlr_user-act_delete?id={$user->id}"><img src="{$assets}images/forms/icon_minus.gif" width="21" height="21" alt="" /></a></div>
						<div class="right">
							<h5>Delete current user</h5>
							<ul class="greyarrow">
								<li><a href="ctlr_user-act_delete?id={$user->id}">Click here </a></li>
							</ul>
						</div>
						
						<div class="clear"></div>
					{/if}
				</div>
				<div class="clear"></div>
			</div>
		</div>	
{/block}